<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ taglib uri="/WEB-INF/tld/pms-tag.tld" prefix="mypms" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/grid.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/global.js"></script>
<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css">
<script language="JavaScript"  src="${ctx}/scripts/show.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/public.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/ajaxException.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/div/common.js"></script>


<script type="text/javascript">
	var ACTION_URL= "${ctx}/customer_customerAction.do?";
	//参与类型
	function getParticipantTypeCode(){
		return window.frames("customerList").participantTypeCode;
	}
	//客户类型
	function getCustomerTypeCode(){
		return window.frames("customerList").customerTypeCode;
	}
	//个人信息ID
	function getParticipantID(){
		return window.frames("customerList").participantID;
	}
	//客户ID
	function getClientID(){
		return window.frames("customerList").clientID;
	}

	//当点击查询时，使用本事件进行提交
	function submitSearch1(){
		$(search1).action= ACTION_URL + "method=search";
		$(search1).submit();
		//reLoadIFrameListWithQuery();
	}

	function gjSearch(){
		var url= ACTION_URL + "method=initCustomerSearch";
		top.windowOpen(url, 'houseChoose', '高级查询', 500, 550,false,'houseChoose');
	}

	function openAddLessee(){
		var url = "${ctx}/customer_lesseeAction.do?method=initLesseeAddMain";
		top.windowOpen(url, "addLessee", "新增租户资料", 620, 900);
	}

	function openOwnerAdd(){
		var url = "${ctx}/customer_ownerAction.do?method=initOwnerAddMain";
		top.windowOpen(url,'addOwner','新增业主资料',620,900,true,'addOwnerFrame');
	}

	function init(){
	 	$('customerList').src= ACTION_URL + "method=initCustomerList";
	 	$('search1').action= ACTION_URL + "method=search";
	}

	function openOwnerEdit(){
		var url = "${ctx}/customer_ownerAction.do?method=initOwnerEditMain";
		top.windowOpen(url,"editOwner","修改业主资料",610,900);
	}

	/*
	When you double-click a record, the judgement of the types of customers,
	and trigger events, a new pop-up window, to see more details.
	*/
	function openDetail(){
		var url = null;
		if(getCustomerTypeCode()=='001'){//owner
			url = "${ctx}/customer_ownerAction.do?method=initOwnerDetailMain&curParticipantTypeCode=" + getParticipantTypeCode()+"&curParticipantId="+getParticipantID();
			top.windowOpen(url,"ownerDetail","业主详细信息",610,900,true,"ownerDetail");
		}else if(getCustomerTypeCode()=='002'){
			url = "${ctx}/customer_lesseeAction.do?method=initLesseeDetailMain&participantTypeCode=" + getParticipantTypeCode()+"&participantId="+getParticipantID();
			top.windowOpen(url,"lesseeDetail","租户详细信息",610,900,true,"lesseeDetail");
		}else{
			Alert("请选择一条记录！");
		}
	}

	//家庭成员信息
	function openMembo(){


	if(getCustomerTypeCode()=='001'){
		var url="${ctx}/customer_memberAction.do?method=showMainMemberInfoList&clientType=" +getCustomerTypeCode()+"&clientId="+getClientID()+"&ownerId="+getParticipantID();
		top.windowOpen(url,"openMembo","家庭成员维护",410,900);
	}else if(getCustomerTypeCode()=='002'){
		var url="${ctx}/customer_memberAction.do?method=showMainMemberInfoList&clientType=" +getCustomerTypeCode()+"&clientId="+getClientID()+"&ownerId="+getParticipantID();
		top.windowOpen(url,"openMembo","家庭成员维护",410,900);
	}else{
			Alert("请选择一条记录！");


	}
	}
	//重新加载列表页面,不保留条件的刷新
	function reloadFrame(){
		var url = ACTION_URL + "method=search&ec_s_sysDate=DESC";
		$('customerList').src = url;
	}

	//重新加载列表页面,用于高级查询
	function reloadFrameGj(){
		reLoadIFrameListWithQuery();
		$('customerName').value = "";
		$('houseNumber').value = "";
		$('customerType').index = 0;
	}

	//重新加载列表页面,保留查询条件的刷新
	function reLoadIFrameListWithQuery(){
		window.frames("customerList").freshFrame();
	}

	function openCustomerEdit(){
	  if(getParticipantID() == "")
	  {
	   Alert('请选择一条记录后再修改!');
	   return false;
	  }
       var param="&participantID="+getParticipantID()+"&customerTypeCode="+getCustomerTypeCode()+"&participantTypeCode="+getParticipantTypeCode();
       var url = "${ctx}/customer_customerAction.do?method=editCustomer"+param;
		top.windowOpen(url,"custmerEdit","修改资料",610,900);
	}

	function showDeleteCustomer(){

	  if(getParticipantID() == "")
	  {
	   Alert('请选择一条记录后再删除!');
	   return false;
	  }
	  AlarmConfirm('${key.tipsByDeleteConfirm}',"main","deleteCustomer");
	 }

	function deleteCustomer(){
	   var param="&participantID="+getParticipantID()+"&customerTypeCode="+getCustomerTypeCode()+"&participantTypeCode="+getParticipantTypeCode();
       var url = "${ctx}/customer_customerAction.do?method=deleteCustomer"+param;
       new Ajax.Request(url,{
				parameters :param ,
				onSuccess : function(response) {
                 if('true' == response.responseText.strip()){
                 	reLoadIFrameListWithQuery();
               	} else {
               		ajaxSubmitException(response.responseText);
               	}
				}});
	}
</script>
</head>

<body  onload="init()">
<div style="height:520px;overflow:auto;">
<div class="pageNav_bg">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td id="pageNav_leftimg"><img src="${ctx}/images/ico_custome_household.gif" width="46" height="47"/></td>
      <td id="navWord"><span class="page_title">当前住户管理</span></td>
      <td class="pageNav_right"><a href="javascript:showFull_in();"><img id="full_image"  src="${ctx}/images/ico_fullscreen.gif" border="0"/></a></td>
    </tr>
  </table>
</div>
<div class="container">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
      <td>
	 <table width="100%" border="0" cellpadding="0" cellspacing="0">
  	<tr>
      <td class="bg_search">
	  <!-----------------------------搜索1----------------------------->
	  <table border="0" cellpadding="0" cellspacing="0" id="search01" >
	  <form action="" id="search1" method="post" target="customerList">
        <tr>
		  <td class="grid align_left">房号：<input name="houseNumber" autocomplete="off" type="text" class="inputtext" size="16"></td>
		  <td class="grid align_left">姓名：<input name="customerName" autocomplete="off" type="text" class="inputtext" size="16"></td>
		  <td class="grid align_left">电话：<input name="telephone" autocomplete="off" type="text" class="inputtext" size="16"></td>
		  <td class="td_search">
		  	<table border="0" cellpadding="0" cellspacing="0">
            	<tr>
              	<td class="buttonOffLeft" id="btn1_11"></td>
              	<td class="buttonOffMiddle" id="btn1_12" onblur="btn_change(1)" onMouseOver="btn_change_over(1)" onMouseOut="btn_change_out(1)" onclick="submitSearch1()"><img src="${ctx}/images/ico_searchico.gif" alt="" border="0" align="absmiddle"> 查询</td>
      	        <td class="buttonOffRight" id="btn1_13"></td>
				</tr>
          	</table>
          </td>

          <td class="td_search">&nbsp;</td>
          <td class="td_search">&nbsp;</td>
		  <td class="td_search">&nbsp;</td>
		  <td class="td_search">&nbsp;</td>
          <td></td>

        </tr>
        </form>
      </table>

	  </td>
    </tr>
    <tr>
      <td>
          <table width="100%" border="0" cellpadding="0" cellspacing="0">

            <tr>
              <td class="bg_toolBar"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="40%">&nbsp;</td>
                  <td width="60%" align="right">
                  <!--------------------------右边图标01----------------------------------->
                    <table border="0" cellpadding="0" cellspacing="0" id="ico1">
                      <tr>
                      <pms:AuthTag authName="menu.nopage.addCustomer">
					  <td class="toolbarico" onmouseover="showmenulist('quick_menumore',this)" onMouseOut="hidden2menu('quick_menumore')"><a href="#"><img src="${ctx}/images/ico_newfile.gif" alt="登记业主资料" width="16" height="16" border="0" align="absbottom" /><img src="${ctx}/images/img_nav_third.gif" alt="更多登记" border="0" align="absbottom"/></a></td>
                     </pms:AuthTag>
                     <pms:AuthTag authName="customer_customerAction.do?method=editCustomer">
                        <td class="toolbarico"><a href="#"  onClick="openCustomerEdit();"onFocus="this.blur()"><img src="${ctx}/images/ico_amend.gif" border="0" align="absbottom" alt="修改住户资料"/></a></td>
                     </pms:AuthTag>
                     <pms:AuthTag authName="customer_customerAction.do?method=deleteCustomer">
                        <td class="toolbarico"><a href="#" onClick="showDeleteCustomer();" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删除" width="16" height="16" border="0" align="absbottom"></a></td>
                     </pms:AuthTag>
                     <pms:AuthTag authName="customer_customerAction.do?method=exportCustomerInfoToExcel">
                       <td class="toolbarico">
	                   <a href="${ctx}/customer_customerAction.do?method=exportCustomerInfoToExcel" onfocus="this.blur()">
	                   <img src="${ctx}/images/ico_excel.gif" alt="导出到文件"  border="0" align="absbottom" />&nbsp;导出到文件 </a>
	                   </td>
	                   </pms:AuthTag>
                     <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                      </tr>
                    </table>

                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td valign="top">
				<iframe  id="customerList"  name="customerList" height="450px" frameborder="0" border="0" src="" width="100%" ></iframe>
			 </td>
    </tr>
  </table>
</div>

<div id="quick_menumore" class="quick_menu2" >
  <table width="100%" border="0" cellpadding="1" cellspacing="0" class="grid_quickMenu_bg" onMouseOver="showmy2menu('quick_menumore')" onMouseOut="hidden2menu('quick_menumore')">
       <tr>
      <td>
	  <table width="100%" border="0" cellpadding="1" cellspacing="0">
	  <pms:AuthTag authName="customer_ownerAction.do?method=initOwnerAddMain">
	    <tr>
         <td class="quickMenu_toolbarico"><a href="#" onClick="openOwnerAdd();" onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" alt="新增业主资料" border="0" align="absbottom"/>&nbsp;新增业主资料</a></td>
          </tr>
       </pms:AuthTag>
       <pms:AuthTag authName="customer_lesseeAction.do?method=initLesseeAddMain">
        <tr>
         <td class="quickMenu_toolbarico"><a href="#" onFocus="this.blur()" onClick="openAddLessee();"><img src="${ctx}/images/ico_newfile.gif" alt="新增租户资料" border="0" align="absbottom"/>&nbsp;新增租户资料</a></td>
          </tr>
       </pms:AuthTag>
      </table></td>
    </tr>
  </table>
</div>
&nbsp;
  </body>
</html>

